package com.jxw.quanxiancontentprovider;

import android.content.ContentProvider;
import android.content.ContentValues;
import android.content.UriMatcher;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.net.Uri;
import com.jxw.constant.Constant;
import com.jxw.database.QuanXianDatabaseHelper;

/* loaded from: classes.dex */
public class QuanXianContentProvider extends ContentProvider {
    public static final String AUTHORITY = "com.jxw.quanxiancontentprovider1";
    public static final int CODE = 1;
    public static final String PATH = "quanxianset";
    public static final String QUANXIAN_CONTENT_TYPE = "vnd.android.cursor.dir/vnd.quanxianset.quanxianset";
    public static final Uri QUANXIAN_URI = Uri.parse("content://com.jxw.quanxiancontentprovider1/quanxianset");
    private static UriMatcher urimatcher = new UriMatcher(-1);
    private SQLiteDatabase database;
    private QuanXianDatabaseHelper helper;

    static {
        urimatcher.addURI(AUTHORITY, PATH, 1);
    }

    @Override // android.content.ContentProvider
    public boolean onCreate() {
        this.helper = new QuanXianDatabaseHelper(getContext());
        return false;
    }

    @Override // android.content.ContentProvider
    public String getType(Uri uri) {
        if (urimatcher.match(uri) == 1) {
            return QUANXIAN_CONTENT_TYPE;
        }
        throw new IllegalArgumentException("Unknown URI " + uri);
    }

    @Override // android.content.ContentProvider
    public Cursor query(Uri uri, String[] strArr, String str, String[] strArr2, String str2) {
        this.database = this.helper.getReadableDatabase();
        if (urimatcher.match(uri) == 1) {
            return this.database.query(Constant.QUANXIAN_INFO_TABLE, strArr, str, strArr2, null, null, str2);
        }
        throw new IllegalArgumentException("Unknown URI " + uri);
    }

    @Override // android.content.ContentProvider
    public Uri insert(Uri uri, ContentValues contentValues) {
        this.database = this.helper.getReadableDatabase();
        if (urimatcher.match(uri) == 1) {
            this.database.insert(Constant.QUANXIAN_INFO_TABLE, null, contentValues);
            return null;
        }
        throw new IllegalArgumentException("Unknown URI " + uri);
    }

    @Override // android.content.ContentProvider
    public int delete(Uri uri, String str, String[] strArr) {
        this.database = this.helper.getReadableDatabase();
        if (urimatcher.match(uri) == 1) {
            return this.database.delete(Constant.QUANXIAN_INFO_TABLE, str, strArr);
        }
        throw new IllegalArgumentException("Unknown URI " + uri);
    }

    @Override // android.content.ContentProvider
    public int update(Uri uri, ContentValues contentValues, String str, String[] strArr) {
        this.database = this.helper.getReadableDatabase();
        if (urimatcher.match(uri) == 1) {
            return this.database.update(Constant.QUANXIAN_INFO_TABLE, contentValues, str, strArr);
        }
        throw new IllegalArgumentException("Unknown URI " + uri);
    }
}
